Skip to content

Use WebElement.getDomProperty for element src#2538

Merged
labkey-tchad merged 1 commit intorelease25.7-SNAPSHOTfrom
25.7_fb_simpleModuleTestGetDomProperty
Jul 9, 2025
Merged

Use WebElement.getDomProperty for element src#2538
labkey-tchad merged 1 commit intorelease25.7-SNAPSHOTfrom
25.7_fb_simpleModuleTestGetDomProperty

Conversation

@labkey-tchad
Copy link
Member

Rationale

When converting this to not use the deprecated WebElement.getAttribute, I mistakenly picked getDomAttribute to get the src attribute for some thumbnails. Running this test on a server with a contextPath configured revealed this error. The src attribute includes the server's contextPath but our test helpers generally do not expect relative URLs to include the contextPath (e.g. /labkey/_webdav/SimpleModuleTest%20Project/%40files/focusPopup.jpg). getDomProperty gets the absolute URL as interpreted by the browser (e.g. http:localhost:8080/labkey/_webdav/SimpleModuleTest%20Project/%40files/focusPopup.jpg).

WebElement.getDomAttribute gets the literal attribute (el.attributes['src'] in JavaScript) but WebElement.getDomProperty gets the attribute as interpreted by the browser (el.src in JavaScript)

Related Pull Requests

Changes

  • Use WebElement.getDomProperty for element src

@labkey-tchad labkey-tchad requested review from a team and labkey-chrisj and removed request for a team July 8, 2025 00:00
@labkey-tchad labkey-tchad merged commit 7bc7243 into release25.7-SNAPSHOT Jul 9, 2025
7 of 8 checks passed
@labkey-tchad labkey-tchad deleted the 25.7_fb_simpleModuleTestGetDomProperty branch July 9, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants